import request from '@/utils/request'

// 查询限时活动商品列表
export function listPanicGoods(query) {
  return request({
    url: '/market/panicGoods/list',
    method: 'get',
    params: query
  })
}
// 查询限时活动商品详细
export function getPanicGoods(id) {
  return request({
    url: '/market/panicGoods/' + id,
    method: 'get'
  })
}

// 新增限时活动商品
export function addPanicGoods(data) {
  return request({
    url: '/market/panicGoods',
    method: 'post',
    data: data
  })
}

// 修改限时活动商品
export function updatePanicGoods(data) {
  return request({
    url: '/market/panicGoods',
    method: 'put',
    data: data
  })
}


// 删除限时活动商品
export function delPanicGoods(id) {
  return request({
    url: '/market/panicGoods/' + id,
    method: 'delete'
  })
}

// 上移
export function moveUpGoods(data) {
  return request({
    url: '/market/panicGoods/moveUpGoods',
    method: 'post',
    data: data
  })
}

// 下移
export function moveDownGoods(data) {
  return request({
    url: '/market/panicGoods/moveDownGoods',
    method: 'post',
    data: data
  })
}

// 状态修改
export function changePanicGoodsStatus(id, isShow) {
  const data = {
    id,
    isShow
  }
  console.log(data)
  return request({
    url: '/market/panicGoods/changeStatus',
    method: 'post',
    data: data
  })
}
